<template>
  <div class="goods" @click="goodsDetail">
    <div class="picture"><img v-lazy="{src:item.img640_url,loading:lazyPic}" alt=""></div>
    <div class="title">{{item.goods_name}}</div>
    <div class="price"><span class="curr"><i>￥</i><em>{{item.flash_price}}</em></span></div>
    <div class="btn">GO &gt;</div>
  </div>
</template>

<script>
  export default {
    props:['parentData'],
    data(){
      return{item:{},lazyPic:require('../../assets/img/publicImg/loading_default.png') }
    },
    created(){
      this.item=this.parentData;
    },
    methods:{
      goodsDetail(){
        this.$emit('childEvent',this.item.goods_id);
      }
    }
  }
</script>

<style lang="less" scoped>
.goods-container{
  display: flex;
  flex-wrap: wrap;
  font-family: '微软雅黑';
  margin: 0 0.15rem;
  padding: 0.1rem 0.1rem 0rem;
  font-size: 0.3rem;
}
.goods{
  width: 1.9rem;
  padding: 0.1rem;
  font-family: "微软雅黑";
  margin-right: 0.12rem;
  margin-bottom: 0.12rem;
  background: #fff;
  box-sizing: border-box;
  position: relative;
  .picture{
    width: 100%;
    padding-top: 100%;
    position: relative;
    img{
      width: 100%;height: 100%;
      position: absolute;
      top: 0;left: 0;
    }
  }
  .title{
    height: 0.35rem;
    line-height: 0.35rem;
    font-size: 0.26rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .price{
    line-height: 0.3rem;
    padding-top: 0.12rem;
    font-size: 0.26rem;
    color: #D21D3D;
    i,em,del{font-style: normal;}
    .curr{font-weight: 600;i{font-size: 0.26rem;}}
    .prev{color: #999999;font-size: 0.24rem;}
  }
  .btn{
    width: 0.75rem;height: 0.32rem;
    color: #fff;
    border-radius: 0.06rem;
    line-height: 0.32rem;
    font-size: 0.2rem;
    text-align: center;
    position: absolute;
    bottom: 0.12rem;right: 0.15rem;
    background: #D21D3D;
  }
}
</style>